home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3.iso
/
chapte25
/
ex12.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-23
|
2KB
|
39 lines
#include <genstub.c>
// Windows message procedure.
LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch ( uMsg )
{
case WM_COMMAND: /* process menu items */
switch ( LOWORD( wParam ) )
{
case IDM_TEST: {
TCHAR szBuffer[128];
HDC hDC = GetDC( hWnd );
// Pause five seconds to fill queue.
TextOut( hDC, 0, 0, szBuffer, wsprintf(szBuffer, "%s", "DO INPUT NOW" ));
Sleep( 5000 );
// check queue for keyboard input
wsprintf( szBuffer, "Queue Status - QS KEY - %x ",
HIWORD( GetQueueStatus( QS_KEY ) ) );
TextOut( hDC, 0, 20, szBuffer, lstrlen( szBuffer ) );
// check queue for any mouse input
wsprintf( szBuffer, "Queue Status - QS MOUSE - %x ",
HIWORD( GetQueueStatus( QS_MOUSE ) ) );
TextOut( hDC, 0, 40, szBuffer, lstrlen( szBuffer ) );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return ( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
}
return ( NULL );
}